function http(type){
    var xhr = new XMLHttpRequest()
    var baseUrl =  'https://api.imquzan.com'
    return{
       request:(method,url,data,success,err)=>{
        xhr.open(method,baseUrl+url)
       document.querySelector('.mask').style.display = 'block'
        if (method=='GET'){
            xhr.send()
        } else {
            xhr.setRequestHeader('Content-Type', type==='form'?'application/x-www-form-urlencoded;charset=UTF-8':'application/json')
            // xhr.setRequestHeader('Content-Type', 'application/json')
            if(type==='form'){
                xhr.setRequestHeader('accept', 'application/json, text/plain, */*');
                xhr.setRequestHeader('accept-encoding', 'gzip, deflate, br');
                xhr.setRequestHeader('accept-language', 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6');
                xhr.send(data)
            }else{
                xhr.send(JSON.stringify(data))
            }
        }
        xhr.onreadystatechange = function () {
            document.querySelector('.mask').style.display = 'none'
            if(xhr.readyState === 4 && xhr.status === 200) {
                console.log(xhr.responseText);
                success(JSON.parse(xhr.responseText),baseUrl)
            }else{
                if(err)err();
            }
        }
       }
    }
 }